import { Modal, Button, Table } from 'antd';
import React from 'react';
import Title from '../../../indemnitySheet/components/Title/Title';
import moment from 'moment';
const indemnityCountTable = props => {
	const { createModalVisible, handleModalCount, countData, passengerName } = props;
	const columns = [
		{
			title: '补偿类型',
			dataIndex: 'payType',
			align: 'center',
			render: (PAYTYPE) => (
				<>
					<span style={{ display: PAYTYPE === "0" ? "block" : "none" }}>不正常航班</span>
					<span style={{ display: PAYTYPE === "1" ? "block" : "none" }}>异常行李</span>
					<span style={{ display: PAYTYPE === "2" ? "block" : "none" }}>旅客超售</span>
				</>
			)
		},
		{
			title: '补偿单号',
			dataIndex: 'orderId',
			align: 'center',
			width: 180
		},
		{
			title: '补偿单状态',
			dataIndex: 'status',
			align: 'center',
			render: (STATUS) => (
				<>
					<span style={{ display: STATUS === "0" ? "block" : "none" }}>草稿</span>
					<span style={{ display: STATUS === "1" ? "block" : "none" }}>审核中</span>
					<span style={{ display: STATUS === "2" ? "block" : "none" }}>通过</span>
					<span style={{ display: STATUS === "3" ? "block" : "none" }}>生效</span>
					<span style={{ display: STATUS === "4" ? "block" : "none" }}>关闭</span>
					<span style={{ display: STATUS === "5" ? "block" : "none" }}>未通过</span>
					<span style={{ display: STATUS === "6" ? "block" : "none" }}>驳回</span>
					<span style={{ display: STATUS === "7" ? "block" : "none" }}>待审核</span>
					<span style={{ display: STATUS === "8" ? "block" : "none" }}>逾期</span>
					<span style={{ display: STATUS === '9' ? 'block' : 'none' }}>注销</span>
					<span style={{ display: STATUS === '10' ? 'block' : 'none' }}>已发放</span>
				</>
			)
		},
		{
			title: '补偿金额',
			dataIndex: 'payMoney',
			align: 'center'
		},
		{
			title: '是否冻结',
			dataIndex: 'switchOff',
			align: 'center',
			render: (SWITCHOFF) => (
				<span>{SWITCHOFF === 0 ? "未冻结" : "已冻结"}</span>
			)
		},
		{
			title: '领取状态',
			dataIndex: 'receiveStatus',
			align: 'center',
			render: (RECEIVESTATUS) => (
				<>
					<span style={{ display: RECEIVESTATUS === "0" ? "block" : "none" }}>未领取</span>
					<span style={{ display: RECEIVESTATUS === "1" ? "block" : "none" }}>已领取</span>
					<span style={{ display: RECEIVESTATUS === "2" ? "block" : "none" }}>领取中</span>
				</>
			)
		},
		{
			title: '申请人',
			dataIndex: 'applyUser',
			align: 'center'
		},
		{
			title: '申请时间',
			dataIndex: 'applyTime',
			align: 'center',
			render: (APPLYTIME) => (
				<span>{moment(APPLYTIME).format("YYYY-MM-DD")}</span>
			)
		}
	]
	return (
		<Modal
			destroyOnClose={true}
			onCancel={() => { handleModalCount(false) }}
			footer={null}
			width={"90%"}
			title={[
				<Title key="title" title={`${passengerName} 旅客总补偿次数`} />
			]}
			visible={createModalVisible}
		>
			<Table
				columns={columns}
				dataSource={countData}
				bordered
				pagination={false}
				scroll={{ x: 900 }}
				rowKey="orderId"
			/>
			<div style={{ textAlign: "center", paddingTop: "20px" }}>
				<Button onClick={() => { handleModalCount(false) }} type="primary">关闭</Button>
			</div>
		</Modal>
	)
}

export default indemnityCountTable